package educationaladministrationsystem.CSM.Controller.StudentAndTeacher;

import educationaladministrationsystem.Class.Student;
import educationaladministrationsystem.Class.Teacher;
import educationaladministrationsystem.Result.Result;
import educationaladministrationsystem.CSM.Mapper.Service.StudentAndTeacher.Certification.CertificationService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

@RestController
@RequestMapping("StudentAndTeacher/Certification")
public class CertificationController {
    @Autowired
    CertificationService certificationService;

    @GetMapping("/getAllProfessionMajor")
    public Result getAllProfessionMajor() {
        return Result.success(certificationService.getAllProfessionMajor());
    }

    //    根据专业号获取院系号
    @GetMapping("/getFacultiesIdByMajorProgramId")
    public Result getFacultiesIdByMajorProgramId(@RequestParam String id) {
        return Result.success(certificationService.getFacultiesIdByMajorProgramId(id));
    }

    //    获取专业人数
    @GetMapping("/getMajorNum")
    public Result getMajorNum(@RequestParam String id) {
        return Result.success(certificationService.getMajorNum(id));
    }

    //    上传学生认证信息
    @PostMapping("/uploadStudentCertification")
    public Result uploadStudentCertification(@RequestBody Student student) {
        certificationService.uploadStudentCertification(student);
        return Result.success();
    }

    @GetMapping("/getTeacherNum")
    public Result getTeacherNum() {
        return Result.success(certificationService.getTeacherNum());
    }

    //    上传教师认证信息
    @PostMapping("/uploadTeacherCertification")
    public Result uploadTeacherCertification(@RequestBody Teacher teacher) {
        certificationService.uploadTeacherCertification(teacher);
        return Result.success();
    }
}
